{extend name="public:base"}
{block name='css'}
<style>
    ::-webkit-scrollbar {display:none}
     .list .item-title{max-width: 61%;}
</style>
{/block}

{block name='body'}
<div class="view view-main white-navbar white-toolbar">
    <div data-name="home" class="page">

        <div class="navbar">
            <div class="navbar-inner">
                <div class="left"><a href="{$my_prev_url|default='/'}" class="external"><i class="iconfont icon-fanhui"></i></a></div>
                <div class="center"><span>充值记录</span></div>
                <div class="right"></div>
            </div>
        </div>

        <div class="page-content infinite-scroll-content">


            <div class="js-state" style="display: block;">
                <div class="list tx-list">
                    <ul>
                    </ul>
                </div>
                {include file='public:loading' /}
            </div>

        </div>


    </div>
</div>
{/block}

{block name="js"}
<script>
    function getList() {
        var obj = $('.js-state');
        var total = obj.find('.li').length;
        if (total % 10 != 0) {
            return false;
        }

        if (obj.find('.loading').is(':visible') || obj.find('.no-more').is(':visible') || obj.find('.no-data').is(':visible')) {
            return false;
        }
        obj.find('.loading').show();

        var p = total / 10;
        $.post("/recharge_details", {page:p+1,type:1, user_type:"{:input('user_type', 0, 'intval')}",ids:''}, function(data){
            var str = '';
            $('.loading').hide();
            if (data.data.length > 0) {
                $.each(data.data, function(i,n){
                    str += '<li>\n' +
                        '    <div class="external item-content">\n' +
                        '        <div class="item-inner">\n' +
                        '            <div class="item-title">\n' +
                        '                <span style="color:red">'+(n.state==0?'审核中':(n.state==1?'已通过':'已驳回'))+'</span>\n' +
                        '                <div class="item-footer">金额 '+n.amount+'</div>\n' +
                        '            </div>\n' +
                        '            <div class="item-title y">\n' +
                        // '                <span>'+n.symbol+'￥'+n.amount+'</span>\n' +
                        '                <div class="item-footer">'+n.add_time+'</div>\n' +
                        '            </div>\n' +
                        '        </div>\n' +
                        '    </div>\n' +
                        '</li>';
                });
                if (data.data.length < 10) {
                    obj.find('.no-more').show();
                }
                $(str).appendTo(obj.find('ul'));
            } else {
                if (total > 0) {
                    obj.find('.no-more').show();
                } else {
                    obj.find('.no-data').show();
                }
            }
        }, 'json');
    }
    $(function(){
        getList();
    });
    //触发无限滚动
    $$('.infinite-scroll-content').on('infinite', function () {
        getList();
    });
</script>
{/block}